import React, { Component } from 'react';
import { connect } from 'dva';
import { IndexPageStyle, IndexPageContent } from './style';
import TopPage from '../components/topPage';
import LeftPage from '../components/leftPage';
import CenterPage from '../components/centerPage';
import RightPage from '../components/rightPage';

class IndexPage extends Component {
  constructor(props) {
    super(props);
    this.state = {
      sdfs:'1'
    };
  }
  getAllData=(e)=>{ 
    this.child.getMapDataList(e.name)
  }
  onRef=(ref)=>{
    this.child = ref 
  }
  onRef1=(ref)=>{
    this.right = ref 
  }
  onRef2=(ref)=>{
    this.center = ref 
  }
  storeClick=id=>{
    this.right.getSalesGoodsTop(id);
    this.right.getRealTimeSales(id);
    this.center.getWeeksSales({storeId:id});
  }
  render() {
    return (
      <IndexPageStyle>
        <TopPage />
        <IndexPageContent>
          {/* 左侧内容 */}
          <LeftPage  onRef={this.onRef} storeClick={this.storeClick} />
          {/* 中间内容 */}
          <CenterPage className='center-page' getAllData={this.getAllData}  onRef={this.onRef2} />
          {/* 右侧内容 */}
          <RightPage onRef={this.onRef1} />
        </IndexPageContent>
      </IndexPageStyle>
    );
  }
}

export default connect()(IndexPage);
